package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.diss.CreateDissBo;
import com.zhuss.bean.bo.core.diss.DeleteDissBo;
import com.zhuss.bean.bo.core.diss.UpdateDissBo;
import com.zhuss.bean.bo.core.diss.StartDissBo;
import com.zhuss.bean.bo.core.diss.StopDissBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.core.diss.DissOperateServiceExt;
import com.zhuss.exception.DzcxException;


/**
 * @description: 吐槽操作的Controller
 * @author: zhushanshuo
 * @create: Tue Feb 02 15:22:08 CST 2021
 **/
@RestController
@RequestMapping("/diss")
public class DissOperateController extends BaseController {
	
	@Autowired
	@Qualifier("dissOperateService")
	private OperateService<Void, Object> dissOperateService;
	
	@Autowired
	@Qualifier("dissOperateServiceExt")
	private DissOperateServiceExt dissOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateDissBo bo) throws DzcxException {
		
		dissOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateDissBo bo) throws DzcxException {
		
		dissOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteDissBo bo) throws DzcxException {
		
		dissOperateService.delete(bo);
    }
	
	/**
	 * 启用
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/start")
    public void start(@RequestBody StartDissBo bo) throws DzcxException {
		
		dissOperateServiceExt.start(bo);
    }
	
	
	/**
	 * 停用
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/stop")
    public void stop(@RequestBody StopDissBo bo) throws DzcxException {
		
		dissOperateServiceExt.stop(bo);
    }
	
}
